layui.use(['table','form', 'layedit', 'laydate','jquery','layer'], function () {
    var table = layui.table
        ,form = layui.form
        // ,layer = layui.layer
        ,layer = parent.layer === undefined ? layui.layer : parent.layer
        ,laydate = layui.laydate
        ,$ = layui.jquery;
    form.on('submit(demo1)', function(data){
        $.ajax({
            type: "post",
            url: ctx+"/user/create.do",
            contentType: "application/json",
            async: false,
            data: JSON.stringify(data.field),
            success: function (res) {
                if (res.resultCode == 10000) {
                    var index = parent.layer.getFrameIndex(window.name);
                    parent.layer.close(index);
                    parent.layer.msg(res.msg, {icon: 1});
                    parent.location.reload()
                } else {
                    layer.msg(res.msg, {icon: 2});
                }
            },
        });
    })





});